//-----------------------------------------------------------------------------
//
// @file	Quaternion.h
// @brief	Quaternion classes
// @author	Vinod Melapudi
// @date	20Feb2010
//
//-----------------------------------------------------------------------------

#ifndef _QUATERNION_H
#define _QUATERNION_H

#include "Vector.h"

class Quaternion
{
public:
	Quaternion() : v(), w(0) {}
	~Quaternion() {}

	Quaternion( const Vector3& _v, float _w=0.f );

	void Set( const Vector3& _v, float _w=0.f );
	void FromAngleAxis( const Vector3& axis, float angle );

	float normsqr() const;
	float norm() const;
	Quaternion normalize() const;

	Quaternion operator* ( float s ) const;
	Quaternion operator/ ( float s ) const;

	Quaternion operator* ( const Quaternion& q ) const;
	Quaternion Inverse() const;

	Vector3 Rotate( const Vector3& v ) const;

	Vector3 v;
	float w;
};

#endif